package  ${cfg.package_dir}.${cfg.cfgName};

import lombok.extern.slf4j.Slf4j;
import org.springframework.context.annotation.Configuration;
<#if cfg.async>
// async
import org.springframework.scheduling.annotation.Async;
import org.springframework.scheduling.annotation.EnableAsync;
</#if>
<#if cfg.scheduled>
// scheduled
import org.springframework.scheduling.annotation.EnableScheduling;
import org.springframework.scheduling.annotation.Scheduled;
</#if>
<#if cfg.nacos>
// nacos
import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
</#if>
<#if cfg.openFeign>
// feignclient
import org.springframework.cloud.openfeign.EnableFeignClients;
</#if>
@Configuration
@Slf4j
<#if cfg.async>
@EnableAsync
</#if>
<#if cfg.scheduled>
@EnableScheduling
</#if>
<#if cfg.nacos>
@EnableDiscoveryClient
</#if>
<#if cfg.openFeign>
@EnableFeignClients( basePackages = { "${cfg.package_dir}.feign" })
</#if>
public class SpringCloudConf {
<#if cfg.scheduled>
    /*
    * 6位表达式  周的位置1-7 周一到周日
    * 定时任务不应该被阻塞,但方法默认是阻塞的:1.异步线程池执行任务 2.定时任务线程池spring.task不好使  3.@async
    */
    @Async
    @Scheduled(cron = "* * * * * 4")
    public void scheduled(){}
</#if>
}
